<?php

/**
 * Yii Controller ContactController
 *
 * @author <KTD SOFT>
 * @since Jan 22, 2013 - 10:03:18 AM
 */
class ContactController extends BackController
{

    public $modelName = 'Contact';

    public function init()
    {
        parent::init();
        $this->controllerMenu = array();
        $this->controllerMenu = array();

        $this->controllerMenu[] = array(
            'label' => Yii::t('post', 'All'),
            'url'   => $this->createUrl('contact/index', array('lang' => $this->lang))
        );
    }

    public function save($action = 'Create')
    {
        $this->model->created_at = time();
        $status                  = parent::save($action);
        return $status;
    }

    public function actionUpdate()
    {
        if ($this->model->status == Contact::STATUS_NEW)
        {
            $this->model->status = Contact::STATUS_CONFIRM;
            $this->model->update(array('status'));
        }
        parent::actionUpdate();
    }

}

/** 
 * End file ContactController
 */
